<?php
class masterkey_ctl_admin_jk extends desktop_controller
{

    /*
    *  京东请求电子面单
    */
    public function jdMD()
    {
        if($_POST)
        {
            //防止空格
            foreach ($_POST as $key => $val) {
                $_POST[$key]=str_replace(' ','',$val);
            }
            $this->begin();
            if(empty($_POST['delivery_bn'])){
                $this->end(false, '不能为空！');
            }
            $deliveryModel = app::get('ome')->model('delivery');
            $wmsdeliveryModel = app::get('wms')->model('delivery');
            $wmsdeliverydata = $wmsdeliveryModel->getList('outer_delivery_bn',array('delivery_bn'=>$_POST['delivery_bn'])); 
            $omedeliverydata= $deliveryModel->getList('delivery_id',array('delivery_bn'=>$wmsdeliverydata[0]['outer_delivery_bn']));
            if(!$omedeliverydata){
                $this->end(false, '当前发货单找不到！');
            }
            $res=kernel::single('ome_event_trigger_logistics_electron')->delivery_retry($omedeliverydata[0]['delivery_id']);
            var_dump($res);
        }
        $this->page('admin/jdMD.html');
    }
}
